
<script>
	$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		var name = $( "#name" ),
			email = $( "#email" ),
			password = $( "#password" ),
			allFields = $( [] ).add( name ).add( email ).add( password ),
			tips = $( ".validateTips" );

		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}

		function checkLength( o, n, min, max ) {
			if ( o.val().length > max || o.val().length < min ) {
				o.addClass( "ui-state-error" );
				updateTips( "Length of " + n + " must be between " +
					min + " and " + max + "." );
				return false;
			} else {
				return true;
			}
		}

		function checkRegexp( o, regexp, n ) {
			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass( "ui-state-error" );
				updateTips( n );
				return false;
			} else {
				return true;
			}
		}
		
		$( "#addgroup" ).dialog({
			autoOpen: false,
			height: 300,
			width: 350,
			modal: true,
			buttons: {
				"提交": function() {
                        $.post('/address/addgroup', $("#addGroupForm").serialize(), function(data){
                           if(data.code == 0){
                                window.location.href = '/address';
                                $(this).dialog("close");
                            } else {
                                alert(data.message);
                            } 
                        }, 'json');
                    
                    return false;
				},
				"取消": function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});

		$( "#btnAddGroup" )
			.click(function() {
				$( "#addgroup" ).dialog( "open" );
			});
	});
	</script>
    <div id='addgroup' title="添加新分组">
       <p>加 * 号为必填项</p>
        <form id="addGroupForm">
            <filedset>
                <label for='name'>名称：</label>
                <input type="text" name="cg_name" id="name" />
                <label for="desc">描述：</label>
                <textarea rows="3" cols="3" name="cg_desc" id="desc"></textarea>
            </filedset>
        </form>
    </div>


    <div class="jsqf_box">
        <div class="jsqf_content">

            <div class="book_box">
                <div class="book_left">
                    <div class="titlea"> 
                        分组 
                    </div>
                    <div class="book_left_bt">
                        <a href="#" id="btnAddGroup" title="新增"><img
                                src="/misc/images/addbt.jpg" alt="新增号码组" width="42"
                                height="20" border="0" /> </a>
                    </div>
                    <dl id="groupList">

                            <dd id="group4086">  
                                <div class="btboxa">
                                    <div class="titleb"  onclick="chooseClass($(this))" style="cursor: hand;" title="组名:缺省组 ,不重复号码数:0 " >


                                            缺省组 

                                    </div>
                                    <div class="btbox_left"  onclick="chooseClass($(this))" style="display:none;  cursor: hand;">

                                    </div>
                                    <div class="btbox_right">
                                        <span> <a href="#"
                                            onclick="mobileGroupEdit($(this));" class="btnEditGroup"
                                            title="编辑"><img src="/misc/images/editbt.jpg"
                                                    alt="编辑" width="18" height="18" border="0" /> </a> </span>
                                        <span> <a href="#" title="删除"
                                            onclick="deleteGroup($(this));"><img
                                                    src="/misc/images/deletebt.jpg" alt="删除" width="18"
                                                    height="18" border="0" /> </a> </span>
                                    </div>
                                </div>
                            </dd>


                    </dl>

                    <div class="viciao" > 
                        <ul id="pageBar2">

                        </ul>
                    </div>
                    <form id="form2" name="form2" action="/user/mobileGroup_search.do" method="post">
                                        <input type="hidden" name="page" value="1" id="page2"/>
                                        <input type="hidden" name="gID" value="" id="gID"/>

                                </form>




                </div>
                <div class="book_right">
                    <div class="titlea">
                        <label id="moileTitle">
                            手机号码
                        </label>
                        <label id="updateMesssage"
                            style="float: right; display: none; color: 'red'"></label>
                    </div>
                    <div class="book_right_top">
                        <div class="book_right_left">
                            <dl>
                                <dd>
                                    <select id="searchGroup">
                                        <option value="current">
                                            当前组 
                                        </option>
                                        <option value="all">
                                            全部的组
                                        </option>

                                    </select>
                                </dd>
                                <dd>
                                    <select id="filterBy">
                                        <option value="mobile">
                                            手机号码
                                        </option>
                                        <option value="name">
                                            姓名
                                        </option>
                                    </select>
                                </dd>
                                <dd>
                                    <input type="text" size="6" id="searchBy" />
                                </dd>
                                <dd>
                                    <a href="#" id="btnGuestBookSearch" title="搜索"><img
                                            src="/misc/images/searchbt.jpg" alt="搜索" width="23"
                                            height="21" border="0" align="top" /> </a>
                                </dd>
                            </dl>

                        </div>
                        <div class="book_right_right">
                            <span> <a href="#" id="btnMobileAdd" title="新增"><img
                                        src="/misc/images/addbt.jpg" alt="新增" width="42"
                                        height="20" border="0" /> </a> </span>
                            <span> <a href="#" id="btnMobileDel" title="删除"><img
                                        src="/misc/images/delbt.jpg" alt="删除" width="42"
                                        height="20" border="0" /> </a> </span>
                            <span> <a href="#" id="btnMobileInput" title="导入"><img
                                        src="/misc/images/daorubt.jpg" alt="导入" width="42"
                                        height="20" border="0" /> </a> </span>
                        </div>

                    </div>
                    <div id="daochu" style="display:none;">
                    <span ><a href="#"  id="exportExcel" >导出号码</a></span>
                    </div>
                    <div class="book_right_list" >
                        <table class="book_order">

                            <tbody id="mobileList">
                            </tbody>
                        </table>
                    </div>
                    <div class="viciao" style="margin-top: 10px">
                        <ul id="pageBar">

                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
        <div class="jsqf_foot"></div>
    </div>
</div>
